<template>
    <div>
        <el-card shadow="never" class="mb-3">
            <p style="color: #666;font-size: 16px;">输入敏感词请用 <span style="color: #ffc200;">#</span> 分割</p>
            <el-input v-model="textarea" style="width: 100%;margin-top: 24px;" :rows="10" type="textarea" placeholder="Please input" />
            <div style="display: flex; justify-content: flex-end;margin-top: 30px;" @click="updateWord">
                <el-button type="primary" v-permission="'sys:sensitiveword:btn:edit'">修改</el-button>
            </div>
        </el-card>
    </div>
</template>

<script lang="ts" setup>
import { getSensitiveword, upsertSensitiveword } from '@/api/Talk';
import { ref } from 'vue'
defineOptions({ name: 'Sensitiveword' });
const textarea = ref('')
const id = ref(null)
getSensitiveword().then(res => {
    console.log(res);
    textarea.value = res.data.words
    id.value = res.data.id
})
const updateWord = () => {
    upsertSensitiveword({
        id:  id.value,
        words:textarea.value
    }).then((res:any)=> {
        ElMessage.success('修改成功！')
        
    })
}
</script>

<style lang="scss" scoped></style>